package com.imooc.pan.feignservice;

import com.imooc.pan.entity.RPanUserFile;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * @author Janson
 * @Description TODO
 * @Date 2023/8/6
 */
@Component
@Slf4j
public class UserFileServiceFallbackFactory implements FallbackFactory<UserFileServiceClient> {
    @Override
    public UserFileServiceClient create(Throwable cause) {
        return new UserFileServiceClient() {
            @Override
            public RPanUserFile getUserRootFile(Long userId) {
                log.error("远程调用上传文件的接口发生熔断:{}",cause.toString(),cause);
                return null;
            }
        };
    }
}
